<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
                      "http://www.w3.org/TR/html4/strict.dtd"> 
<html> 
  <head> 
    <title>Contact Example</title> 
 
    <script type="text/javascript" charset="utf-8" src="phonegap.js"></script> 
    <script type="text/javascript" charset="utf-8"> 
 
    // Wait for PhoneGap to load 
    // 
    function onLoad() { 
        document.addEventListener("deviceready", onDeviceReady, false); 
    } 
 
    // PhoneGap is ready 
    // 
    function onDeviceReady() { 
        var options = new FileUploadOptions(); 
        options.fileKey="file"; 
        options.fileName="newfile.txt"; 
        options.mimeType="text/plain"; 
 
        var params = new Object(); 
        params.value1 = "test"; 
        params.value2 = "param"; 
 
        options.params = params; 
 
        var paths = navigator.fileMgr.getRootPaths(); 
        var ft = new FileTransfer(); 
        ft.upload(paths[0] + "newfile.txt", "http://some.server.com/upload.php", win, fail, options); 
    } 
 
    function win(evt) { 
        console.log("Code = " + r.responseCode); 
        console.log("Response = " + r.response); 
        console.log("Sent = " + r.bytesSent); 
    } 
 
    function fail(evt) { 
        alert("An error has occurred: Code = " = error.code); 
    } 
 
    </script> 
  </head> 
  <body onload="onLoad()"> 
    <h1>Example</h1> 
    <p>Read File</p> 
  </body> 
</html> 
